fix(sdk-api): guard v1 auth path against undefined accessToken in testnet - #9405
Draft
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
Draft
fix(sdk-api): guard v1 auth path against undefined accessToken in testnet#9405bitgo-ai-agent-dev[bot] wants to merge 1 commit into
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
Conversation
…tnet When BitGoAPI is constructed with accessToken: undefined (e.g. TESTNET_ACCESS_TOKEN env var not set) and a request sets forceV1Auth = true, the v1 auth condition previously evaluated as: (undefined && ...) || true → true causing the request to set Authorization: 'Bearer undefined', which the server rejects with an 'undefined access token' error. Fix: require this._token to be truthy before entering the v1 path, so forceV1Auth cannot bypass the token guard. Unauthenticated requests now proceed without an Authorization header (the existing behaviour for requests with no token) rather than sending a literally-undefined bearer value. Ticket: WCI-1213 Session-Id: 90ff7750-f83b-4600-a00a-fb07afa1cb4a Task-Id: a55a5860-e651-49e1-9ea1-0867be6b19d3
ralph-bitgo
Bot
force-pushed
the
wci-1213-fix-undefined-access-token-testnet
branch
from
August 3, 2026 14:03
dedbd32 to
d73cfab
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Why
Test plan
Ticket: WCI-1213